package com.tvein.sanguo.controller.Game
{
	//flash
	//pureMVC
	import org.puremvc.as3.multicore.interfaces.ICommand;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
	//custom
	import com.tvein.sanguo.view.ApplicationMediator;
	import com.tvein.sanguo.controller.Game.system.Console;
	import com.tvein.sanguo.controller.Game.system.LoadFile;
	import com.tvein.sanguo.controller.Game.system.TveinLogin;
	import com.tvein.sanguo.controller.Game.system.GameStatus;
	import com.tvein.sanguo.controller.Game.system.ModuleInit;
	import com.tvein.sanguo.controller.Game.system.ModuleLoad;
	import com.tvein.sanguo.controller.Game.system.ModuleFile;
//
	public class SystemConsole extends SimpleFabricationCommand implements ICommand
	{
		private var sanguoMediator:ApplicationMediator;
		
		override public function execute(notification:INotification) : void
		{
			sanguoMediator = facade.retrieveMediator(ApplicationMediator.NAME) as ApplicationMediator;
			
			sanguoMediator.sysLog.appendText(notification.getBody() + "\n");
			
			var commandInstance:ICommand;
			
			switch(notification.getBody()[0])
			{
				case "-loadFile":
					commandInstance = new LoadFile();
					break;
				case "-console":
					commandInstance = new Console();
					break;
				case "-tveinLogin":
					commandInstance = new TveinLogin();
					break;
				case "-gameStatus":
					commandInstance = new GameStatus();
					break;
				case "-moduleInit":
					commandInstance = new ModuleInit();
					break;
				case "-moduleLoad":
					commandInstance = new ModuleLoad();
					break;
				case "-moduleFile":
					commandInstance = new ModuleFile();
					break;
			}
			
			commandInstance.initializeNotifier(multitonKey);
			commandInstance.execute(notification);
		}
	}
}